Technical Tips + from the International Helpdesk

1. UNIFACE for Windows 95 and OLE support

The OLE-container Widget under the Windows 95 version of UNIFACE 6.1.dl can contain OLE objects, for example a Word document, an Excel spreadsheet or a bitmap. It is not possible however to assign an object with proc code to an OLE-container/field unless the data is already stored in another field. For example: olefield1 = olefield2. In this case olefield2 should already contain valid data.

There are five ways to get data in an OLE-container:

  1. Via the clipboard, via a paste in the container field. Condition is that the clipboard should contain an OLE-object.

  2. Via drag and drop in the container field. You can take an OLE-object from Word for example and drag and drop it in a UNIFACE container field.

  3. By clicking the right mouse button on top of an OLE-field. You will get a menu with as last item ‘insert ...’. With this menu item you can create objects.

  4. With the proc assignment as described above(olefield1=olefield2).

  5. The ‘OleInsertObject’ instruction displays an Insert Object dialog box which allows the user to load an embedded or linked object into a field. It must be performed from a ‘perform’ statement. The name of the target field must be set in $50 and the field must be defined as a raw data field.

You can see therefore it is not possible to assign an object to a OLE-container via a proc statement but there are several ways to work around it.

2. Using Devicetables on MS-Windows

This article covers:

1. General layout of a device table.
2. Devicetables for screen display on Windows.
3. Devicetables for printing on Windows.

1. General layout of a devicetable:

A devicetable is structured like:

BEGIN_DEVICE
mode mappings
END_DEVICE
BEGIN_SET 0
select statement
character mappings
END_SET
BEGIN_SET 1
select statement
character mappings
END_SE
T

Where:

  • A character mapping maps a UNIFACE internal character to an external command, like:
    ^233 0.A

This will map the UNIFACE internal character A from UNIFACE font 0 to the ASCII value 233.

  • The select statement is a command which will preceed any character mapping contained in a set. On Windows this statement is used to select a font.

  • The mode mappings send certain commands to the device when a specific mode is used.

These modes are all mapped to the ^NUL command on Windows.

Example:

BEGIN_DEVICE
^NUL MODE_0(80,25)
END_DEVICE
BEGIN_SET 0
^198 select
^233 3.A
END_SET

When the devicetable above is used to display the UNIFACE internal character 3.A, ^198^233 will be sent to the device.

2. Devicetables for screen display on windows.

For screen display on Windows, devicetables are used for the following objects:

window titles
menus
form text
unifields
dialog texts

The font to display these texts is for the form texts and the unifields, the selected font in the ini file (font0). For window titles, menus and dialog texts, the font is selected by Windows. The select statements are never used in device tables on Windows (have a look in MSwin3). This effectively means that all character mappings can be contained in one set.

To see which characters can be displayed with certain fonts, use the program Character Map. When you want to display the UNIFACE internal character 0.C as a ‚ and the used font is Courier, you will need to map 0.C to ^199, because ‚ is 199 in font Courier. Take special care that the font used for window titles, menus and dialog texts is chosen by Windows. This will make it virtually impossible to use foreign characters for these objects unless a foreign version of Windows is used. So, although you can display cyrillic text in an unifield as soon as you will have a cyrillic font available on Windows, you will need a cyrillic version of Windows to display cyrillic text in a Window title (formtitle). An example of a device table which will map the UNIFACE internal character 0.C as a ‚ and the UNIFACE internal character 3.A to a B:

BEGIN_DEVICE
^NUL MODE_0(80,25)
END_DEVICE

BEGIN_SET 0
^199 0.C
^066 3.A
END_SET

3. Devicetables for printing on Windows

A devicetable which is used for printing on Windows will contain a line:

MSWIN3 type

between BEGIN_DEVICE and END_DEVICE.

In the print devicetables the different sets will contain a select statement which will influence the choice of printfont. The three different select commands that exist are:

^ESC^100 which will select an ANSI font
^ESC^101 which will select an OEM font
^ESC^102 which will select a symbol font

The font selection will work as follows:

First it will be checked whether the selected font in the ini file is of the same type as required by the select statement in the devicetable. If not, a different font will be selected, which is of the type required by the select statement. The Microsoft fonts ‘Courier New’, ‘Courier New CE’ and ‘Courier New Cyr’ are all of the type ANSI. So if your printer font is Courier New Cyr and you want to map the UNIFACE internal character 0.A to character 200 (capital Labda) you will need to have the following mapping:

BEGIN_DEVICE
MSWIN3 type
END_DEVICE
BEGIN_SET 0
^ESC^100 select
^200 0.A
END_SET

Some fonts present themselves not as ANSI fonts, but for example as OEM fonts. This will immediately lead to problems. Due to the font selection process, the user will not see what he expects. This situation can only be avoided by changing the devicetable. When for example a cyrillic font is used that presents itself as an OEM font and you would like to map the UNIFACE internal character 0.A to character 200, you will need the following mapping:

BEGIN_DEVICE
MSWIN3 type
END_DEVICE
BEGIN_SET 0
^ESC^101 select
^200 0.A
END_SET

3. Sybase Open Client on the Macintosh

The following difficulties can occur when installing/ using UNIFACE and Sybase 10.0.2 on both Macintosh platforms:

1 Wrong version of the Apple Shared Library Manager: If your widgets work fine, you don’t have this problem.

2 Wrong version of the Sybase driver in the extensions folder: You can even have multiple versions of the Sybase driver, giving you this message ‘unable to load ... ’.

3 Sybase Client software not correctly installed: Unfortunately checking with dbping doesn’t guarantee a correct installation for use with UNIFACE.

Advised procedure:

  • Choose open client installer

    • select Sybase runtime environment

    • select open client aslm support

  • Click on Install

  • Look in the Sybase folder for the lib folder. In the libfolder you will find the ASLM folder, in which you will find a folder called: ‘put me in the system extension folder’. This folder contains 9 items (libblk, libcomn, libcs, libct, libintl, libsybdb, libtcl, libtcp). Move these files to the Mac system extension folder.

  • Not enough memory to load the driver. This is the most unlikely cause of the problem.

4. Here is some additional information for getting UNIFACE to work with Sybase. To get it to work it is mandatory to:

a) Have an absolutely clean environment for installation. *
b) Prevent 64K and Power PC versions from being mixed. * *
c) Make sure the Sybase ASLM libraries are in the Extensions folder. ***

* Before Sybase and UNIFACE can be installed, all files that are part of an older version have to be removed. (For Sybase, the Sybase config (control panels) and the libraries with extension 10.02) (For UNIFACE the complete UNIFACE folder, including the preferences)

* * When Sybase is installed either the Power PC version or 64K version must be installed; NOT both.

When UNIFACE is installed a full install has to be performed, including entering the SEK.

*** You must put the Sybase Shared Libraries in the extensions folder yourself, the Sybase installation program does not do this. If these libraries are not in the extensions folder, sybping will work, however UNIFACE will say ‘You have no library that implements the 3GL function udbsyb’.


Copyright 1996 Compuware Corporation. All Rights Reserved. Questions or comments about this site, E-mail us at www@compuware.com.